{include file="public/user_head" /}
<body>
<div class="page-body">
    {include file="public/user_dh" /}


    <div class="grow-menu " data-url="{:url('msg',array('clause'=>'in'))}">
        <img src="/static/wap/mod/index-menu-msg.png" class="grow-menu-icon"/>
        <span class="grow-menu-label">收件箱</span>
        <img src="/static/wap/mod/images/common_select.png" class="grow-menu-select"/>
    </div>
    <div class="grow-menu " data-url="{:url('msg',array('clause'=>'out'))}">
        <img src="/static/wap/mod/index-menu-msg.png" class="grow-menu-icon"/>
        <span class="grow-menu-label">发件箱</span>
        <img src="/static/wap/mod/images/common_select.png" class="grow-menu-select"/>
    </div>
    <div class="grow-menu " id="xiexinxi" data-url="1">
        <img src="/static/wap/mod/index-menu-msg.png" class="grow-menu-icon"/>
        <span class="grow-menu-label">写信息</span>
        <img src="/static/wap/mod/images/common_select.png" class="grow-menu-select"/>
    </div>

    <script type="text/javascript">
        $(".grow-menu").on('click', function() {
            if(this.dataset.url != 1){
                window.location.href = this.dataset.url;
            }
        });
    </script>

    <script type="text/javascript">
        var path = "";
        var href = 'javascript:void(0);';
        var onClick = 'javascript:void(0);';
    </script>



    <script type="text/javascript">
        $(".head-icon-left").on("click", function () {
            window.history.go(-1);
        });

        if (path != undefined && path.length > 0) {
            document.write("<div id='dd' class='float-icon'><a href='"+href+"' onclick='"+onClick+"' /><img src='" + path + "'  class='float-icon-img'></a></div>");
        }
    </script>

    <div class="shouhuodizhi" id="shouhuodizhi" style="display:none;">
        <div style="padding:20px 50px;">
            <form class="form-horizontal">
                <div class="form-group">
                    <label for="x1" class="col-sm-3 control-label">收信人:</label>
                    <div class="col-sm-9">
                        <input style="width:100%" class="form-control" value = "[管理员]" readonly id="x1" >
                        <br>
                    </div>
                </div>

                <div class="form-group">
                    <label for="x2" class="col-sm-3 control-label">发送内容:</label>
                    <div class="col-sm-9">
                        <textarea style="width:100%;height:200px" class="form-control" rows="3" id="x2"  placeholder="短信内容"></textarea>
                    </div>
                </div>
                <div class="form-group"></div>
                <div class="form-group">
                    <div class="col-sm-12">
                        <button type="submit" class="btn btn-primary btn-block" onClick="xiexxgo(this);return false;">发送信息</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <script>
        $("#mlindex").addClass("btn-long16");
        var indexdd;
        $(".goneirong").click(function(e) {
            var ti=$(this);
            var data="id="+encodeURI(ti.attr("cid"));
            var uid=ti.parent().parent().attr('uid');
            var tit=ti.text();
            $.post("/mobile/bin.php?act=msg_get",data,function(e){
                    tishi2close();
                    if(e!=""){
                        $(ti).parent().parent().find("span[mread='1']").removeClass('youjian');
                        if(uid){
                            layer.msg(tit+':<br>'+unescape(e),{time: 20000,skin: 'long-class', btn: ['马上回复', '取消'],btn1: function(){
                                    location='msg.php';
                                }})
                        }else{

                            layer.msg(tit+':<br>'+unescape(e),{time: 20000,skin: 'long-class', btn: ['确定'],btn1: function(){}})
                        }
                    }
                },'html'
            );


            return false;
        });


        $("#xiexinxi").click(function(e) {
            indexdd=layer.open({type: 1,title:'写信息',area: '90%',skin: 'layui-layer-rim',content: $("#shouhuodizhi")});
        });


        function xiexxgo(t){
            var top=$(t).parent().parent().parent();
            var x1=top.find("#x1").val();
            var x2=top.find("#x2").val();
            if(!checkMobile(x1) && x1 != '[管理员]'){
                tishi4('玩家编号不正确',top.find("#x1"));
                return false;
            }
            if(x2==''){
                tishi4('请填写短信内容',top.find("#x2"));
                return false;
            }
            var data="username="+encodeURI(x1)+"&info="+encodeURI(x2);
            $.post("/mobile/bin.php?act=msg_post",data,function(e){
                    tishi2close();
                    if(e!=""){
                        layer.msg(unescape(e),{time: 500,shade: 0.3,end:function(){
                                if (unescape(e)=="信件已发出"){window.location.href='/mobile/msg.php?clause=out';}
                            }})
                    }
                },'html'
            );
            return false;
        }

    </script>

</div>
<script type="text/javascript">
    $(".head-icon-left").on("click", function () {
        window.history.go(-1);
    });
</script>
{include file="public/footer" /}
</body>
</html>